package mongoDB_text;

import java.util.Properties;

import com.mongodb.MongoClient;
import com.mongodb.client.MongoDatabase;

public class BaseDao {
	private static Properties file = new Properties();

	public MongoDatabase connect() {
		MongoClient mongoClient = null;
		try {
			file.load(BaseDao.class.getClassLoader().getResourceAsStream("config.properties"));
			mongoClient = new MongoClient(file.getProperty("url"), Integer.parseInt(file.getProperty("port")));
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
		return mongoClient.getDatabase("Student");
	}
}
